package com.xiangxiangjd.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.xiangxiangjd.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xiangxiangjd.service.ClaimConsumablesService;
import com.xiangxiangjd.bean.ClaimConsumables;
import com.xiangxiangjd.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 耗材申领表 前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2021-11-08
 */
@Controller
@RequestMapping("/api/claimConsumables")
@Api(tags = "已经申领耗材统计")
public class ClaimConsumablesController extends BaseController{




    /** 分页查询ClaimConsumables
     * @param page  页码
     * @param limit  查几条
     * @param claimConsumables  前端传进的参数
     * @return 返回统一分页信息
     */
    @PostMapping(value = "admin/findClaimConsumablesByPage")
    @ResponseBody
    public ResultPage findClaimConsumablesByPage(Integer page, Integer limit,ClaimConsumables claimConsumables){
             return claimConsumablesService.findClaimConsumablesByPage(page,limit,claimConsumables);
    }

    /** 添加ClaimConsumables
     * @param claimConsumables  前端传进的参数
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/addClaimConsumables")
    @ResponseBody
    public ApiResultModel saveClaimConsumables(ClaimConsumables claimConsumables  ){
             return claimConsumablesService.addClaimConsumables(claimConsumables);
    }

    /** 编辑ClaimConsumables
     * @param claimConsumables  前端传进的参数
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/editClaimConsumables")
    @ResponseBody
    public ApiResultModel editClaimConsumables(ClaimConsumables claimConsumables  ){
             return claimConsumablesService.editClaimConsumables(claimConsumables);
    }

    /** 删除ClaimConsumables
     * @param ids  前端传进的ID
     * @return 返回统一信息
     */
    @PostMapping(value = "admin/delClaimConsumables")
    @ResponseBody
    public ApiResultModel delClaimConsumables(@RequestParam("datas") ArrayList ids){


             return claimConsumablesService.delClaimConsumabless(ids);
    }





}
